package com.lh.bootswagger.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by yangle on 2020/01/07.
 */
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(name = "t_api_permission")
public class ApiPermission implements Serializable {

	private static final long serialVersionUID = 2185660841127755309L;

	@Id
	@Column(name = "id", nullable = false, length = 20)
	private Long id;

	/**
	 * 1：启用， 2：停用
	 */
	@Column(name = "is_open", nullable = true, length = 1)
	private Integer isOpen;

	@OneToOne(optional = false)
	@JoinColumn(name = "APPLY_ID", referencedColumnName = "APPLY_INFO_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	private ApplyKey applyKey;

	@OneToOne(optional = false)
	@JoinColumn(name = "API_INTERFACE_ID", referencedColumnName = "ID")
	@NotFound(action = NotFoundAction.IGNORE)
	private ApiInterface apiInterface;
}
